package org.ewaf.framework.util;

import java.io.Serializable;

public class KeyValue implements Serializable, Cloneable {

	private static final long serialVersionUID = 1229748947490976818L;

	private Object key;
	private Object value;
	
	public KeyValue(Object key, Object value) {
		this.key = key;
		this.value = value;
	}

	public Object getKey() {
		return key;
	}

	public Object getValue() {
		return value;
	}

	public void setKey(Object key) {
		this.key = key;
	}

	public void setValue(Object value) {
		this.value = value;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		
		if (!(obj instanceof KeyValue)) {
			return false;
		}
		
		KeyValue kv = (KeyValue) obj;
		return kv.key.equals(key) && kv.value.equals(value);
	}

	@Override
	public int hashCode() {
		return key.hashCode();
	}

	@Override
	public String toString() {
		return key + ":" + value;
	}
	
	@Override
	public KeyValue clone() throws CloneNotSupportedException {
		return (KeyValue) super.clone();
	}
	
}
